﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
namespace ObjectLibrary
{
    public class MySkinning3DModel : MyModel
    {
        private float _anlpha;

        public float Anlpha
        {
            get { return _anlpha; }
            set { _anlpha = value; }
        }

        public MySkinning3DModel(ContentManager content, string strName, float scale, Vector3 pos, float rotationY)
        {
            // TODO: Complete member initialization
            _model = content.Load<Model>(strName);
            _transformMatrix = Matrix.Identity;
            Scale = scale;
            Position = pos;
            RotationY = rotationY;
            _anlpha = 1;
        }
        public void Draw(GameTime gameTime, GraphicsDevice graphicsDevice, MyCamera camera, Matrix[] bones)
        {
            foreach (ModelMesh mesh in _model.Meshes)
            {
                foreach (SkinnedEffect eff in mesh.Effects)
                {
                    eff.SetBoneTransforms(bones);

                    eff.EnableDefaultLighting();
                    
                    eff.View = camera.View;
                    eff.Projection = camera.Projection;

                   /*eff.FogEnabled = true;
                    eff.FogStart = 50.0f;
                    eff.FogEnd = 200.0f;
                    eff.FogColor = new Vector3(1.0f, 1.0f, 1.0f);*/

                    eff.Alpha = _anlpha;

                   eff.SpecularColor = new Vector3(0.25f);
                   eff.SpecularPower = 16;
                    eff.World = Matrix.CreateRotationX(-MathHelper.PiOver2) * _transformMatrix;
                }
                mesh.Draw();

            }
          



        }


    }
}
